﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="入库数据检校.aspx.cs" Inherits="syc.Fc.入库数据检校" %>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">

<asp:Label ID="SqlText" runat="server" Text="" Visible="false"></asp:Label>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>">
</asp:SqlDataSource>

<div id="wintop" class="wintop">入库数据对比检校</div>

<asp:Panel ID="Panel1" runat="server" CssClass="panel">

生产单位：<asp:DropDownList ID="ShengChan" runat="server" Width="115" Enabled="false">
            <asp:ListItem Value="1">一分厂</asp:ListItem>
            <asp:ListItem Value="2">二分厂</asp:ListItem>
        </asp:DropDownList>
<!-- =================================================================================================== -->
<!-- ========                               产品类别列表                                     =========== -->
<!-- ========                                                                               =========== -->
<!-- =================================================================================================== -->
<asp:SqlDataSource ID="DS_ChanPin" runat="server" 
                   ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                    SelectCommand="SELECT [ID],[品名]+' '+[钢级]+' '+[规格] AS 名称 FROM [产品]" >
</asp:SqlDataSource>
产品：
<asp:DropDownList ID="ChanPin" runat="server" Width="150px" Font-Size="12px" DataSourceID="DS_ChanPin" 
                               DataTextField="名称" DataValueField="ID" >
</asp:DropDownList>
<!-- =================================================================================================== -->

<br />
入库日期：<asp:TextBox ID="Date1" runat="server" CssClass="textbox" Width="115"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
<span style="display:inline-block;width:84px;text-align:center;">至</span><asp:TextBox ID="Date2" runat="server" CssClass="textbox" Width="115"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date2').value, document.getElementById('Date2'));" />

<span style="display:inline-block;width:30px;text-align:center;"></span>
<asp:Button ID="Button_Query" runat="server" Text="查 询" UseSubmitBehavior="false" 
        CssClass="button" onclick="Button_Query_Click" />

</asp:Panel>

<style>td.grid{cursor:default;}</style>

<div class="gridframe">
    <div class="gridview">
    
        <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
            <tr>
	            <td class="grid-title">入库数据对比</td>
	        </tr>
	        <tr>
	            <td class="grid-back">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" CssClass="grid" DataKeyNames="日期" 
                        DataSourceID="SqlDataSource1"
                        PageSize="100"
                        GridLines="None" ondatabound="GridView1_DataBound" 
                        onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                        UseAccessibleHeader="False" >
                        <PagerSettings Visible="False" />
                        <RowStyle CssClass="grid-row-normal" />
                        <Columns>
                            
                            <asp:TemplateField HeaderText="日期">
                                <ItemTemplate>
                                    <asp:Label ID="Label_rq" runat="server" Text='<%# Eval("日期","{0:d}") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="80px"/>
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="数据源" >
                                <ItemTemplate>
                                    <asp:Label ID="Label_sj" runat="server" Text='<%# Eval("数据") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="left" Width="80px" />
                            </asp:TemplateField>
                            
                             <asp:TemplateField HeaderText="捆数">
                                <ItemTemplate>
                                    <asp:Label ID="Label_ks" runat="server" Text='<%# Eval("捆数") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="80px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="支数">
                                <ItemTemplate>
                                    <asp:Label ID="Label_zs" runat="server" Text='<%# Eval("支数") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="80px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="重量">
                                <ItemTemplate>
                                    <asp:Label ID="Label_zl" runat="server" Text='<%# Eval("重量") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="100px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="长度">
                                <ItemTemplate>
                                    <asp:Label ID="Label_cd" runat="server" Text='<%# Eval("长度") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="100px" />
                            </asp:TemplateField>
                            
                        </Columns>
                        <SelectedRowStyle CssClass="grid-row-selected" />
                      </asp:GridView>
	            </td>
            </tr>
            <tr>
	            <td>   
	                <table width="100%">
	                    <tr>
	                        <td class="pagebar">
                                <asp:Button ID="Button_Pager_First" UseSubmitBehavior="false" runat="server" Text="" ToolTip="首页" 
                                    CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                <asp:Button ID="Button_Pager_Prev" UseSubmitBehavior="false" runat="server" Text="" ToolTip="上一页" 
                                    CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                <input type="button" class="page-split" UseSubmitBehavior="false" disabled />第<asp:TextBox 
                                    ID="TextBox_Pager" AutoPostBack="True" runat="server" CssClass="pageturn" 
                                    ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" disabled /><asp:Label ID="Label_Pages" UseSubmitBehavior="false" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                                
                                <asp:Button ID="Button_Pager_Next" UseSubmitBehavior="false" runat="server" Text="" ToolTip="下一页" 
                                    CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                <asp:Button ID="Button_Pager_Last" UseSubmitBehavior="false" runat="server" Text="" ToolTip="末页" 
                                    CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" /><asp:Label ID="Label9" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                            </td>
                            <td class="pagebar" align="right">
                                <asp:Label ID="Label_Total" runat="server"></asp:Label>
                            </td>
                        </tr>
                   </table>

	            </td>
            </tr>
        </table>
        

    </div>
</div>

</form>
<script>

var msg = '<%=this.msg %>';
if (msg != '') setTimeout('alert(msg)', 100);

var GridView1 = document.getElementById("GridView1");
var Rows = GridView1.rows;
var date = '';
var data = '';
for (var i = 1; i < Rows.length; i++) {
    if (date == Rows[i].cells[0].innerText.replace(' ', '')) {
        if (data != Rows[i].cells[2].innerText.replace(' ', '')
        + Rows[i].cells[3].innerText.replace(' ', '')
        + Rows[i].cells[4].innerText.replace(' ', '')
        + Rows[i].cells[5].innerText.replace(' ', '')) {
            Rows[i].style.backgroundColor = 'red';
        }
    }
    else {
        date = Rows[i].cells[0].innerText.replace(' ', '');
        data = Rows[i].cells[2].innerText.replace(' ', '')
        + Rows[i].cells[3].innerText.replace(' ', '')
        + Rows[i].cells[4].innerText.replace(' ', '')
        + Rows[i].cells[5].innerText.replace(' ', '');
    }
}
</script>
</body>
</html>
